Plugin Introduction

This introduction and whole documentation applies to the EasyAR Sense Unity Plugin which comes with EasyAR Sense 3.1 and above. For older versions, you should read the documents released together with EasyAR Sense (SDK), for EasyAR Sense 1.0 or EasyAR Sense 2.0.

EasyAR Sense Unity Plugin is a very thin wrapper build above EasyAR Sense C# API to expose EasyAR Sense features into Unity. It is always a good practice to read EasyAR Sense Documentation to understand how EasyAR Sense works.

The plugin is not designed to work with different versions of EasyAR Sense, so the plugin still uses the same version rule as EasyAR Sense. Release packages of the plugin has EasyAR Sense libraries inside, so a separate EasyAR Sense package is not required when using the plugin. The EasyAR Sense binary inside the plugin are always the same with the EasyAR Sense in the same version. In case when you are trying to make the plugin work on a different EasyAR Sense version, you must make sure the csapi comes together with the libraries.

All code of EasyAR Sense Unity Plugin is open sourced with well-designed interface. You can use the plugin directly to create AR experience within short time. You can also reference the source code to create more custom usages of EasyAR Sense or even a Unity Plugin of your own.

Inside the Plugin

Scripts

The plugin is designed to be a thin Unity wrapper of EasyAR Sense, so most scripts are controllers of EasyAR Sense components in the 3D scene providing a few extensions in the Unity environment. It helps to organize and connect EasyAR Sense components.

The plugin use as much Unity features as possible, like start/stop in OnEnable/OnDisable, most EasyAR Sense features can work without writing scripts. The plugin does not wrap all functions from EasyAR Sense, all functionalities are exposed to Unity directly through C# API, which is accessible from MonoBehaviours.

The plugin also implements one typical assemble strategy for all EasyAR Sense components in ARAssembly and controls data flow from ARSession. But that is not all of EasyAR Sense. You can always rewrite these two scripts to make a customized AR workflow to use the powerful flexibility of EasyAR Sense API.

The plugin is open sourced. All public types and members are documented in the scripts in both English and Chinese. You are free to change the scripts to extend rendering pipeline support or make custom workflows.

COMPATIBILITY NOTICE: It is not a good choice to change the scripts when you can reach the same result using existing interfaces in most of the case, like a found/lost event handler or controlling objects in the scene. That is because the plugin do not guarantee compatibilities of the script design, all things inside the EasyAR folder are internal resources which will change without notification between releases.

Editors

The plugin provides a few editor features to help development, including

  • Script input parameters before start on the Inspector

  • Runtime control like CenterMode and HorizontalFlipMode

  • Menu entry for license key and cloud service configurations

  • Gizmos for image targets

  • Tools for image target data generation

Prefabs

Prefabs are provided to help fast AR scene build. They are not necessary if you manually arrange scripts in the scene, but it is always a good start to use prefabs when you are new to EasyAR Sense.

Prefabs are classified into two parts,

  • Primitive, is empty node with a script for one component from EasyAR Sense in most case, useful when you are building a customized AR scene.

  • Composite, is combination of primitives to hold general usages, useful for beginners who are not familiar with the assemble system.

Samples

The plugin release comes with a few samples to demonstrate features and combination of different algorithms from EasyAR Sense.

If you are looking for samples in the download page , make sure to download package(s) with Sample in the filename. Those packages contain EasyAR Unity Plugin and samples. You can also find the plugin itself in the same page, with NO Sample in its name. You would find a pure plugin there without any scenes.

Samples are in the Samples folder. They are NOT part of the plugin. Although the Unity will open scripts in the same VS project, they are not designed to be part of the product.

Samples has a launcher; you can start most samples from the launcher. To use the launcher, you must add the launcher scene and all other scenes referenced by the launcher into the build settings.

Samples are designed to be straight forward of showing how API can be used and how EasyAR Sense work. Feel free to build your application on top of the sample or copy sample code for your projects, but remember the sample is NOT the plugin itself, and all codes in the sample are not guaranteed to be reusable in any condition without change.

EasyAR Sense and the plugin has rich APIs. Although important features and usages are demonstrated, the samples still would not cover all API callings and feature usages. If you find the sample do not satisfy the needs of your project, try look for interfaces in the MonoBehaviours and the corresponding EasyAR Sense components first.

Start with samples, they will help you understand how EasyAR Sense and the Unity Plugin work.